﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNCDataSetTableAdapters;
using System.Data;

public partial class Trailer : System.Web.UI.Page
{
    ProductsTableAdapter pro = new ProductsTableAdapter();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ltrVideo.Text = loadvideo();
        }
    }

    public string loadvideo()
    {
        int ProductID = int.Parse(HttpContext.Current.Request.RequestContext.RouteData.Values["ProductID"].ToString());

        string tem = "";
        DataTable dt = pro.GetProductByProductID(ProductID);
        string VideoUrl = dt.Rows[0]["VideoUrl"].ToString();
        lblTitle.Text = dt.Rows[0]["Title"].ToString();
        tem += "'<iframe width=\"640\" height=\"480\" src=\"//www.youtube-nocookie.com/embed/" + VideoUrl + "\" frameborder=\"0\" allowfullscreen></iframe>";
        return tem;

    }
}